package Day015_File类_递归_IO流.ZuoYe;

import java.io.FileOutputStream;
import java.util.Scanner;

/**
 * @author zhangyan
 * @date 2020/5/6 18:27
 */
public class Test9 {
    public static void main(String[] args) throws Exception{

        //创建字节输出流
        FileOutputStream fos = new FileOutputStream("Demo02\\aaa\\d.txt");
        //创建Scanner
        Scanner sc = new Scanner(System.in);
        //无限循环
        for(;;){
            System.out.println("请输入学生信息(格式为:学号-学生名字)");
            System.out.println("以end结束");
            String s = sc.next();
            if (s.equals("end")){
                return;
            }
            //保存录入的字符串
            fos.write((s+"\r\n").getBytes());
        }
    }
}
